﻿--6 - Найти контакты всех пап

select distinct A1.[LastName], A1.[Name], C.[ContactType], C.[ContactValue]
from [MyFamily].[dbo].[Persons] as A1, [MyFamily].[dbo].[Persons] as A2, [MyFamily].[dbo].[Contact] as C
where ((A1.ID = A2.fk_fatherID) and (A1.ID = C.fk_PersonID))

select distinct A1.[LastName], A1.[Name], C.[ContactType], C.[ContactValue]
  from [MyFamily].[dbo].[Persons] as A1, [MyFamily].[dbo].[Contact] as C where A1.ID
 in (select [fk_fatherID] from [MyFamily].[dbo].[Persons] where ([fk_fatherID] is NOT NULL) and (A1.ID = C.fk_PersonID))